package com.repository;


import com.entity.UserInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

public interface UserPagingAndSortingRepository extends PagingAndSortingRepository<UserInfo, Integer> {



    @Query(value = "select * from  sys_user where  is_enable=?1 ", nativeQuery = true)
    Page<UserInfo> findAllByEnabledTrue(boolean flag, Pageable pageable);


    @Query(value = "select * from  sys_user where  nickname=?1 ", nativeQuery = true)
    Page<UserInfo> findAllByNicknameContaining(String word, Pageable pageable);


    @Query(value = "select * from  sys_user where  nickname=?1 and is_enable=?2 ", nativeQuery = true)
    Page<UserInfo> findAllByNicknameContainingAndEnabledTrue(String word, boolean flag,Pageable pageable);
}
